package org.springblade.modules.admin.vo.sugar;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @Description 大屏-报障维修VO
 * @Author ysq
 * @Date 2022/10/14
 **/
@Data
public class MalfunctionScreenVO {

	@JsonInclude(JsonInclude.Include.NON_NULL)
	@ApiModelProperty(value = "项目id")
	private Long projectId;

	@JsonInclude(JsonInclude.Include.NON_NULL)
	@ApiModelProperty(value = "项目名称")
	private String projectName;

	@ApiModelProperty(value = "报障数")
	private Long applyRepairTotal;

	@ApiModelProperty(value = "新增维修任务")
	private Long repairTaskTotal;

	@ApiModelProperty(value = "梯故障率")
	private String eleFaultRatio;

	@ApiModelProperty(value = "重复故障率")
	private String eleRepeatFaultRatio;

	@ApiModelProperty(value = "梯故障率月化")
	private String eleFaultRatioMonth = "0%";

	@ApiModelProperty(value = "重复故障率月化")
	private String eleRepeatFaultRatioMonth = "0%";

	public void setEleFaultRatioMonth(BigDecimal eleFaultRatioMonth) {
		this.eleFaultRatioMonth = String.format("%s%%",eleFaultRatioMonth.multiply(new BigDecimal(100)).setScale(1).toString());
	}

	public void setEleRepeatFaultRatioMonth(BigDecimal eleRepeatFaultRatioMonth) {
		this.eleRepeatFaultRatioMonth = String.format("%s%%",eleRepeatFaultRatioMonth.multiply(new BigDecimal(100)).setScale(1).toString());
	}

	public Long getApplyRepairTotal() {
		if (this.applyRepairTotal == null) {
			this.applyRepairTotal = 0L;
		}
		return applyRepairTotal;
	}

	public Long getRepairTaskTotal() {
		if (this.repairTaskTotal == null) {
			this.repairTaskTotal = 0L;
		}
		return repairTaskTotal;
	}

	public String getEleFaultRatio() {
		if (this.eleFaultRatio == null) {
			this.eleFaultRatio = "0%";
		}
		return eleFaultRatio;
	}

	public String getEleRepeatFaultRatio() {
		if (this.eleRepeatFaultRatio == null) {
			this.eleRepeatFaultRatio = "0%";
		}
		return eleRepeatFaultRatio;
	}

	public void setEleFaultRatio(BigDecimal eleFaultRatio) {
		this.eleFaultRatio = String.format("%s%%",eleFaultRatio.multiply(new BigDecimal(100)).setScale(1).toString());
	}

	public void setEleRepeatFaultRatio(BigDecimal eleRepeatFaultRatio) {
		this.eleRepeatFaultRatio = String.format("%s%%",eleRepeatFaultRatio.multiply(new BigDecimal(100)).setScale(1).toString());
	}
}
